ISCPersistenceUnitCollection Interface

The following table contains information on the ISCPersistenceUnitCollection interface:

Signature

Description

Valid Arguments

ISCPersistenceUnit * Add(VARIANT Locator, VARIANT Disposition [optional])

Adds a new persistence unit to the unit collection

Locator:

  • VT_BSTR � Full path to the erwin DM model. This is the model that is loaded into the persistence unit.

Disposition:

  • VT_BSTR � Arranges access attributes, such as read-only.

Detailed descriptions of the location and format of the Disposition parameters is located in the appendix API Interfaces Reference.

Example 5

The following example illustrates how to open an existing model using C++. The example uses the Application object created in Example 1:

ISCPersistenceUnitPtr OpenModel(ISCApplicationPtr & scAppPtr, CString & csFullPath)
{    
      ISCPersistenceUnitCollectionPtr scPUnitColPtr;
      scPUnitColPtr = scAppPtr->GetPersistenceUnits();
      ISCPersistenceUnitPtr scPUnitPtr = scPUnitColPtr- >Add(COleVariant(csFullPath));
      return scPUnitPtr;
}

The following example illustrates how to open an existing model using Visual Basic .NET. The example uses the Application object created in Example 1:

Public Function OpenModel(ByRef scApp As SCAPI.Application, _
                          fullModelPath As String) As SCAPI.PersistenceUnit
    Dim scPersistenceUnitCol as SCAPI.PersistenceUnits   
    scPersistenceUnitCol = scApp.PersistenceUnits
    
    OpenModel = scPersistenceUnitCol.Add(fullModelPath)
End Sub